import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:map的使用
 * User: 39891
 * Date: 2025-04-09
 * Time: 16:14
 */
public class Test {
    public static void main(String[] args) {
        HashBuck hashBuck = new HashBuck();
        //放的时候val默认为0
        hashBuck.put(1,0);
        hashBuck.put(2,0);
        hashBuck.put(3,0);
        hashBuck.put(4,0);

    }
    public static void main2(String[] args) {
        Set<Integer> set = new TreeSet<>();
        set.add(1);
        set.add(1);
        set.add(3);
        set.add(2);
        Set<String> set2 = new TreeSet<>();
        set2.add("apple");
        set2.add("app");
        set2.add("pea");
        set2.add("fsdjkl");

        System.out.println(set2.contains("app"));
        System.out.println(set2.size());

        Iterator <String> it = set2.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }
        
    }
    public static void main1(String[] args) {
        Map<String,Integer> map = new TreeMap<>();
        map.put("apple",3);
        map.put("love",5);
        map.put("pea",6);
        map.put("pea",6);
        System.out.println(map.get("apple"));
        //取出key
        Set<String> set = map.keySet();
        System.out.println(set);

        Collection<Integer> list = map.values();
        System.out.println(list);
        //打印的是map的每个节点 是一个把map转成set的方法
        Set<Map.Entry<String,Integer>> setE = map.entrySet();
        System.out.println(setE);
    }
}
